#include "stdafx.h"
#include "oil_model.h"

OilModel::OilModel(Common* _common, const QString &_name)
	: common(_common), name(_name)
{
	init_model();
}


OilModel::~OilModel(){}

void OilModel::init_model(){
	//0 - combobox/boolean
	//1 - spinbox
	//2 - textbox
	//3 - label

	QString common_parameter = "COMMON";

	model = new ParametersModel(this);
	model->addItem(common_parameter, "NAME", name, "", 2, 1, "test1");
    model->addItem(common_parameter, "TYPE", 0, "-", 1, 1, "Type 0 is oil, type !0 is gas");
	model->addItem(common_parameter, "DENSITY", 0, "kg/m3", 1, 1, "test2");
	model->addItem(common_parameter, "VISCOSITY//DINAMIC", 0, "CP", 1, 1, "test4");
	model->addItem(common_parameter, "VISCOSITY//KINEMATIC", 0, "", 1, 0, "test5");
    model->addItem(common_parameter, "SVPRESSURE", 0, "Pa", 1, 0, "saturated vapour pressure");
	model->addItem(common_parameter, "SOUND SPEED", 0, "km/h", 1, 1, "SOUND SPEED");
}

void OilModel::update_parameters(){
	common->getParametersWidget()->setItemDelegate(new Delegate(common->getParametersWidget()));
}
